package com.qssoft.cqry.synchdb.handler.client;

import com.github.shyiko.mysql.binlog.event.EventType;
import com.qssoft.cqry.synchdb.adapter.SynchDbAdapter;
import com.qssoft.cqry.synchdb.vo.MysqlBinlogVo;
import lombok.SneakyThrows;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * @author liju.z
 */
public class ClientSynchDbHandler implements SynchDbAdapter {
    /**
     * 处理数据
     *
     * @param synchData
     * @return
     */
    @SneakyThrows
    @Override
    public boolean handler(JdbcTemplate jdbcTemplate, MysqlBinlogVo synchData) {
        EventType eventType = synchData.getEventType();
        return jdbcTemplate.update(synchData.getQueryEventData().getSql()) != 0;
    }
}
